home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / DATABASE / BORUSR2.ZIP;1 / MENU.PRG < prev    next >
Encoding:
Text File  |  1992-07-06  |  10.0 KB  |  270 lines

  1. *-------------------------------------------------------------------------------
  2. *-- Program....: MENU.PRG
  3. *-- Programmer.: Ken Mayer, SofTech, Inc.
  4. *-- Date.......: 11/18/1991
  5. *-- Written for: dBASE IV, 1.1
  6. *-- Notes......: This is the front-end to the BOR-BBS Users listing system ...
  7. *--              This system is based on the database created by Tony Lima
  8. *--              and written to interface with that. Permission to distribute
  9. *--              freely all programs associated with this system (including
  10. *--              the procedure file PROC.PRG) is given by the author.
  11. *-- Revised....: 03/19/1992 -- Added configuration options in menu.
  12. *--              05/14/1992 -- Started re-working system to incorporate quite
  13. *--               a few new features ... includes Mouse support in 1.5.
  14. *--              05/31/1992 -- JOEY added the 'save' of color settings, so that
  15. *--               the user's original settings are restored, no matter what
  16. *--               gets done here ...
  17. *--              06/06/1992 -- Ken -- I am going back through this whole
  18. *--               system today, and working on commenting it more heavily,
  19. *--               with the theory that it may help others who want to use
  20. *--               parts of this code. 
  21. *--             06/15/1992 -- Another attempt at fixing the color problems.
  22. *--               Am setting them specifically here. No calling on the SETCOLOR
  23. *--               and SETCOLOR2 routines in PROC.PRG.
  24. *-- Database...: ATUSERS.DBF
  25. *--      MDX...: ATUSERS.MDX
  26. *--              Index TAG: STATE      Key: upper(hstate)+upper(bstate)
  27. *--              Index TAG: BORBBS_ID  Key: upper(borbbs_id)
  28. *--              Index TAG: LAST_NAME  Key: upper(last_name)
  29. *--              Index TAG: COMPANY    Key: upper(company)
  30. *--              Index TAG: BZIP       Key: BZIP
  31. *--              Index TAG: BSTATE     Key: upper(bstate)
  32. *--              Index TAG: HZIP       Key: HZIP
  33. *--              Index TAG: HSTATE     Key: upper(hstate)
  34. *--   Memo File: ATUSERS.DBT
  35. *-------------------------------------------------------------------------------
  36.  
  37. *-- set the procedure file
  38. set procedure to proc            && a slimmed down PROC22, with mouse stuff
  39.  
  40. *-- basic stuff -- save user's settings. Mostly important for systems
  41. *-- that drop the user back to the dot prompt in dBASE. If you have a system
  42. *-- that never lets the user see the dot prompt, this stuff isn't as necessary.
  43. cStatus = set("STATUS")          && status line
  44. set status off
  45. cTalk   = set("TALK")            && 'talk' mode
  46. set talk off
  47. cEscape = set("ESCAPE")          && 'escape' ... only on when I want it on.
  48. set escape off
  49. cBell   = set("BELL")            && don't beep at me, ok?
  50. set bell off
  51. cScore  = set("SCOREBOARD")      && turn the scoreboard off ...
  52. set scoreboard off
  53. cDeleted = set("DELETED")        && I want to see 'deleted' records ...
  54. set deleted off
  55. cSafety = set("SAFETY")
  56.  
  57. *-- get color settings coming into to program
  58. cStrtColor = set("ATTRIBUTES")
  59.  
  60. *-- Deal with the mouse. This really only works in version 1.5 of dBASE,
  61. *-- but should not cause any problems with version 1.1 (if no mouse driver,
  62. *-- the rest is ignored). Basically the ISMOUSE() routine turns off the
  63. *-- mouse driver (in some cases, like Microsoft and Logitech, at the very
  64. *-- least), and the SETMOUSE routine will toggle the mouse ...
  65. if val(right(trim(version()),3)) > 1.1  && if version of dBASE > 1.1
  66.     if ismouse()                     && turn mouse off if it exists
  67.         public c_Mouse                && necessary for MOUSE routines
  68.         c_Mouse = "OFF"               && if there's a driver, we're turning it off
  69.         on key label alt-m do setmouse && but user can toggle with <Alt>M
  70.     endif 
  71. endif
  72.  
  73. *-- These color vars are used later ... (and ALL OVER the place), and should
  74. *-- be (and are) declared as global.
  75. public cl_wind1,cl_wind2,cl_wind3,cStand,cStand2,cStand3
  76.  
  77. *-- determine color configuration ...
  78. if .not. file("COLOR.MEM") && if this file does not exist, ask ...
  79.     
  80.     *-- check for a monochrome monitor adaptor card -- if IsColor() returns
  81.     *-- .t., then the machine THINKS it has a color monitor ...
  82.     if iscolor()      && if it says .f. then it's gotta have different coding.
  83.         
  84.         *-- check for color
  85.         if yesno(.t.,"Can your computer show color?","","","rg+/gb,w+/n,rg+/gb")
  86.             do center with 12,80,"rg+/gb","Setting color memvars ..."
  87.             *-- set the colors ...
  88.             cStand = "w+/b"
  89.             cStand2 = "rg+/gb"
  90.             cStand3 = "rg+/r"
  91.             *-- now ask about VGA ...
  92.             @12,0 clear
  93.             
  94.             *-- VGA?
  95.             if yesno(.t.,"Do you have VGA?","","","rg+/gb,w+/n,rg+/gb")
  96.                 *-- copy color description to a MEM file used with cdefault.prg
  97.                 do center with 12,80,"rg+/gb","Setting VGA colors ..."
  98.                 *-- copy the VGA 'default' gun descriptions ...
  99.                 set console off
  100.                 run copy clrdesc.fil clrdesc.mem > nul
  101.                 set console on
  102.                 do cdefault                        && load color definitions ...
  103.                 @12,0 clear
  104.             endif
  105.         
  106.         *-- monochrome monitor, but with CGA (or higher) adaptor ...
  107.         else
  108.                 cStand = "w+/n"    
  109.                 cStand2 = "n/w"
  110.                 cStand3 = "n+/w"
  111.         
  112.         endif  && iscolor()
  113.         
  114.         *-- save to a memfile ('normal' mono or color ...)
  115.         save all like cstand* to color.mem
  116.         
  117.     *-- if we're here, we have a monochrome adaptor, and a monochrome monitor ...
  118.     else
  119.     
  120.         cStand = "w/n"    && 'normal' text
  121.         cStand2 = "wI/n"  && inverse video
  122.         cStand3 = "wU/n"
  123.         save all like cStand* to color.mem
  124.     endif
  125.     
  126. *-- if here, COLOR.MEM exists, and all those questions ain't necessary ...
  127. else
  128.     restore from color additive  && file exists, load colors from COLOR.MEM
  129.     *-- if they have VGA, the system should have set CLRDESC.MEM ...
  130.     *-- so we want to load the VGA color combinations ...
  131.     if file("CLRDESC.MEM")
  132.         do cDefault
  133.     endif
  134. endif
  135.  
  136. *-- Now that we have some colors to work from, set the standard windows ....
  137. cl_wind1 = "&cStand2,&cStand,&cStand2"     && the usual
  138. cl_wind2 = "&cStand3,&cStand2,&cStand3"    && error box
  139. cl_wind3 = "&cStand,&cStand2,&cStand"      && others ...?
  140.  
  141. *-- set main colors 
  142. set color of normal to    &cStand
  143. set color of message to   &cStand2
  144. set color of box     to   &cStand2
  145. set color of highlight to &cStand
  146.  
  147. *-- one new item ... check for printer definitions ...
  148. if .not. file("PRINTER.MEM")
  149.     do center with 12,80,"&cStand2","Loading Printer Configuration program ..."
  150.     do pconfig                    && printer configuration program ...
  151. endif
  152.  
  153. *-- opening screen ...
  154. do jazclear
  155. do open_screen
  156.  
  157. *-- opening titles
  158. save screen to tempscrn
  159. define window title from 8,20 to 13,60 color &cl_wind2 double
  160. do shadow with 8,20,13,60        && exploding shadow routine
  161. activate window title
  162. set cursor off
  163. *-- if the mouse is around ...
  164. if type("C_MOUSE") = "C"
  165.     do center with 0,40,"","** MOUSE INSTRUCTIONS **"
  166.     do center with 2,40,"","Toggle the mouse by pressing"
  167.     do center with 3,40,"","<Alt>M (on/off ...)"
  168.     x=inkey(5)
  169.     clear
  170. endif
  171. *-- normal title box ...
  172. do center with 0,40,"","BOR-BBS Users"
  173. do center with 1,40,"","Address/E-Mail Info"
  174. do center with 3,40,"","(c) 1991, 1992, Kenneth J. Mayer"
  175. x=inkey(5)
  176. set cursor on
  177. deactivate window title
  178. release window title
  179. restore screen from tempscrn
  180. release screen tempscrn
  181.  
  182. *-- define and then activate menu ...
  183. do def_menu
  184. if at("RUNTIME",upper(version())) = 0 
  185.     do shadow with 7,28,16,49     && if not runtime, shadow for full menu
  186. else
  187.     do shadow with 7,28,15,49     && otherwise, shadow for menu without
  188.                                   && last option
  189. endif
  190. activate popup pMain
  191. do leave_proc
  192. clear all                        && don't want variables left over when 'quit'
  193.  
  194. *-------------------------------------------------------------------------------
  195. *-- End of Main portion of Program: MENU.PRG
  196. *-------------------------------------------------------------------------------
  197.  
  198. PROCEDURE def_menu  && define the menu
  199.  
  200.     *-- Menu definition for BOR-BBS Users
  201.     define popup pMain from 7,28
  202.     define bar 1 of pMain prompt " BOR-BBS Users Menu " skip
  203.     define bar 2 of pMain Prompt replicate(chr(196),20) skip
  204.     define bar 3 of pMain Prompt " Add Data";
  205.         message "Add new records"
  206.     define bar 4 of pMain Prompt " Search/Update Data";
  207.         message "Search for and View/Edit/Delete data"
  208.     define bar 5 of pMain Prompt " Print Report";
  209.         message "Generate a list of users (hard-copy/screen/ASCII file)"
  210.     define bar 6 of pMain prompt " Configuration";
  211.         message "Modify color/printer configuration"
  212.     define bar 7 of pMain Prompt " Quit";
  213.         message "Leave dBASE, back to Operating System (DOS/Windows/DV/OS2 ...)"
  214.     
  215.     *-- allow this option ONLY if user is using dBASE ...
  216.     if at("RUNTIME",upper(version())) = 0 
  217.         define bar 8 of pMain Prompt " Exit to dBASE"
  218.     endif
  219.     
  220.     on selection popup pMain do choice
  221.     
  222. RETURN
  223.  
  224. PROCEDURE choice                 && Choice from menu ...
  225.  
  226.     @24,0 clear
  227.     do case 
  228.         case bar() = 3
  229.             do borentr              && enter data
  230.         case bar() = 4
  231.             do boredit              && edit/delete data
  232.         case bar() = 5
  233.             do borrep              && generate listings
  234.         case bar() = 6  
  235.             do config               && configure the system
  236.         case bar() = 7     
  237.             close all               && exit
  238.             quit
  239.         case bar() = 8
  240.             deactivate popup        && drop back to dot prompt ..
  241.     endcase
  242.  
  243. RETURN
  244.  
  245. PROCEDURE Leave_Proc          && cleanup after the menu ...
  246.  
  247.     do jazclear
  248.     set status     &cStatus
  249.     set escape     &cEscape
  250.     set bell       &cBell
  251.     set scoreboard &cScore
  252.     set deleted    &cDeleted
  253.     set color   to &cStand
  254.     cReturn = chr(17)+chr(196)+chr(217)  && return key ...
  255.     @10,25 say "Re-start menu with: DO MENU"+cReturn color &cStand3
  256.     @11,27 say "Leave dBASE with: QUIT"+cReturn color &cStand3
  257.     *-- restore colors
  258.     do ReColor with cStrtColor
  259.     set talk       &cTalk
  260.     close all      && files
  261.     
  262.     *-- release popup from memory
  263.     release popup pMain
  264.     
  265. RETURN
  266.  
  267. *-------------------------------------------------------------------------------
  268. *-- The real END OF PROGRAM: MENU.PRG
  269. *-------------------------------------------------------------------------------
  270.